// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Widgets/SCompoundWidget.h"

/**
 * 
 */
class MISCELLANEOUSPROJECT_API SToastSlate : public SCompoundWidget
{
	// FScrollBarStyle(FCoreStyle::Get().GetWidgetStyle<FScrollBarStyle>("Scrollbar"));
public:
	SLATE_BEGIN_ARGS(SToastSlate)
		: _ShowMask(false)
		, _MaskBrush(FCoreStyle::Get().GetBrush( "Border" ))
		, _ShowIcon(false)
		, _IconBrush(FCoreStyle::Get().GetDefaultBrush())
		, _IconSize(FVector2D(250.f))
		, _ToastText()
		, _TextFont(&FCoreStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText"))
		, _TextBackground(FCoreStyle::Get().GetBrush( "Border" ))
		, _ScrollBrush(&FCoreStyle::Get().GetWidgetStyle<FScrollBarStyle>("Scrollbar"))
		, _ToastSize(FVector2D(800.f,600.f))
		, _ToastPadding(FMargin(20.f))
		, _ToastBrush(FCoreStyle::Get().GetBrush("Border"))
	{}
	// 控制是否需要Mask
	SLATE_ARGUMENT(bool, ShowMask)
	// Mask的样式
	SLATE_ARGUMENT(const FSlateBrush*, MaskBrush)
	// 控制是否需要Icon
	SLATE_ARGUMENT(bool, ShowIcon)
	// Icon的样式
	SLATE_ARGUMENT(const FSlateBrush*, IconBrush)
	// Icon的最大宽高值
	SLATE_ARGUMENT(FVector2D, IconSize)
	// Toast的文字
	SLATE_ATTRIBUTE(FText, ToastText)
	// Toast文字的样式
	SLATE_STYLE_ARGUMENT(FTextBlockStyle, TextFont)
	// Toast文字的背景
	SLATE_ARGUMENT(const FSlateBrush*, TextBackground)
	// ScrollBar的样式
	SLATE_STYLE_ARGUMENT(FScrollBarStyle, ScrollBrush)
	// Toast的最大宽高
	SLATE_ARGUMENT(FVector2D, ToastSize)
	// Toast中的内容的边距
	SLATE_ARGUMENT(FMargin, ToastPadding)
	// Toast的背景样式
	SLATE_ARGUMENT(const FSlateBrush*, ToastBrush)
	
	SLATE_END_ARGS()

	/** Constructs this widget with InArgs */
	void Construct(const FArguments& InArgs);

public:
	void SetShowMask(bool InShowMask);
	void SetMaskBrush(const FSlateBrush* InMaskBrush);
	void SetShowIcon(bool InShowIcon);
	void SetIconBrush(const FSlateBrush* InIconBrush);
	void SetIconSize(const FVector2D& InIconSize);
	void SetToastText(const TAttribute<FText>& InToastText);
	void SetTextFont(const FTextBlockStyle* InTextFont);
	void SetTextBackground(const FSlateBrush* InTextBackground);
	void SetScrollBrush(const FScrollBarStyle* InScrollBrush);
	void SetToastSize(const FVector2D& InToastSize);
	void SetToastPadding(const FMargin& InToastPadding);
	void SetToastBrush(const FSlateBrush* InToastBrush);
	
private:
	TSharedPtr<SImage> ToastMask;
	TSharedPtr<SImage> ToastIcon;
	TSharedPtr<SBox> ToastIconBox;
	TSharedPtr<SBorder> ToastBox;
	TSharedPtr<SBox> OutToastBox;
	TSharedPtr<class SMultiLineEditableTextBox> ToastTextBox;
	FEditableTextBoxStyle* TextBoxStyle;
};
